<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  /**
   * @param name type PermissionName = "geolocation" | "notifications" | "push" | "midi" | "camera" | "microphone" | "speaker" | "device-info" | "background-sync" | "bluetooth" | "persistent-storage" | "ambient-light-sensor" | "accelerometer" | "gyroscope" | "magnetometer" | "clipboard";
   * geolocation: 地理位置
   * notifications: 通知
   * push: 推送
   * midi: 音乐设备数字接口
   * camera: 摄像头
   * microphone: 麦克风
   * speaker: 扬声器
   * device-info: 设备信息
   * background-sync: 后台同步
   * bluetooth: 蓝牙
   * persistent-storage: 持久存储
   * ambient-light-sensor: 环境光传感器
   * accelerometer: 加速计
   * gyroscope: 陀螺仪
   * magnetometer: 磁力计
   * clipboard: 剪贴板
   *
   * @return "granted" | "denied" | "prompt";
   * granted: 授予
   * denied: 拒绝
   * prompt: 询问
   */
  navigator.permissions.query({name: 'camera'}).then(result => {
    console.log(result)
  })

  var constraints = {
    // 是否使用视频
    video: true,
    // 是否使用音频
    audio: true,
  };

  window.navigator.mediaDevices.getUserMedia(constraints)
</script>
</body>
</html>
